<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<jsp:include page="/WEB-INF/common/urls.jsp"/>
<html lang="zh-CN">
<head>
    <title>${applicationScope.PROJECT_NAME}-管理员用户添加</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, shrink-to-fit=no">
    <%--图标icon--%>
    <link rel="icon" href="${pageContext.request.contextPath}/favicon.ico" type="image/ico">

    <link rel="stylesheet"
          href="${pageContext.request.contextPath}/lib/bootstrap-5.3.0-alpha1-dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/global.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/main.css">
    <script src="${pageContext.request.contextPath}/lib/bootstrap-5.3.0-alpha1-dist/js/bootstrap.bundle.min.js"></script>
    <script src="${pageContext.request.contextPath}/lib/jquery-3.5.1.min.js"></script>
    <script src="${pageContext.request.contextPath}/js/toast-manager.js"></script>
    <style>
    </style>
    <script>
    </script>
</head>

<body>
<header class="navbar navbar-expand-lg navbar-dark bg-body-secondary">
    <div class="container-fluid">
        <a class="navbar-brand navbar-logo" href="#">
            <svg class="logo" width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">
                <path d="M10,5 L30,5 L35,10 L35,35 L5,35 L5,10 L10,5" fill="none" stroke="#1E88E5" stroke-width="2"/>
                <path d="M10,5 L10,10 L5,10" fill="none" stroke="#1E88E5" stroke-width="2"/>
                <path d="M12,15 L28,15 M12,20 L28,20 M12,25 L28,25 M12,30 L28,30" stroke="#1E88E5" stroke-width="1.5"/>
            </svg>
            <span>${applicationScope.PROJECT_NAME}</span>
        </a>
    </div>
</header>

<main class="main">
    <!-- 侧边栏 -->
    <jsp:include page="sidebar.jsp"/>
    <!-- 主体部分 -->
    <div class="main-content">
        <form action="${adminUrl}${isAdd ? '/user_add' : '/user_edit'}" method="get" class="add-form col-lg-4"
              accept-charset="UTF-8">

            <c:if test="${!isAdd}">
                <div class="mb-3">
                    <label for="input1" class="form-label">用户ID</label>
                    <input type="number" class="form-control" id="input1" name="userId"
                           value="${not empty entity ? entity.userId : ''}" readonly>
                </div>
            </c:if>
            <div class="mb-3">
                <label for="input2" class="form-label">用户名</label>
                <input type="text" class="form-control" name="username" id="input2"
                       value="${not empty entity ? entity.username : ''}" required>
            </div>
            <div class="mb-3">
                <label for="input3" class="form-label">密码</label>
                <input type="text" class="form-control" name="password" id="input3"
                       value="${not empty entity ? entity.password : ''}" required>
            </div>
            <div class="mb-3">
                <label for="input5" class="form-label">姓名</label>
                <input type="text" class="form-control" name="name" id="input5"
                       value="${not empty entity ? entity.name : ''}">
            </div>
            <div class="mb-3">
                <label for="input6" class="form-label">邮箱</label>
                <input type="email" class="form-control" name="email" id="input6"
                       value="${not empty entity ? entity.email : ''}">
            </div>
            <div class="mb-3">
                <label for="input7" class="form-label">手机号</label>
                <input type="text" class="form-control" name="phone" id="input7"
                       value="${not empty entity ? entity.phone : ''}">
            </div>
            <div class="mb-3">
                <button type="submit" class="btn btn-outline-primary">提交</button>
            </div>
        </form>
    </div>
</main>
<jsp:include page="/footer"/>
</body>
</html>